import request from '@/utils/request'

interface OrderItem {
  quanity: number
  productName: string
  commodityPrice: number
  image: string
}

interface Order {
  orderId: number
  payAmount: number
  businessName: string
  businessDeliveryFees: number
  orderItemDTOs: OrderItem[]
}

// 获取已支付订单列表
export const getPaidOrders = () => {
  const token = localStorage.getItem('token')
  return request<Order[]>({
    url: 'http://localhost:8080/user/payedorder',
    method: 'get',
    headers: {
      'Authorization': `Bearer ${token}`
    }
  })
}

// 获取未支付订单列表
export const getUnpaidOrders = () => {
  const token = localStorage.getItem('token')
  return request<Order[]>({
    url: 'http://localhost:8080/user/unpayorder',
    method: 'get',
    headers: {
      'Authorization': `Bearer ${token}`
    }
  })
} 